home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / amos / AMOSList_0197.lzh / AMOSLIST / 000115_amos-request@svcs1.digex.net_Wed Jan 22 19:47:49 1997.msg < prev    next >
Internet Message Format  |  1997-02-02  |  4KB

  1. Received: from svcs1.digex.net (svcs1.digex.net [204.91.197.224])
  2.           by mail1.access.digex.net (8.8.4/8.8.4) with ESMTP
  3.       id TAA21556 for <mcox@access.digex.net>; Wed, 22 Jan 1997 19:47:44 -0500 (EST)
  4. Received: (from daemon@localhost)
  5.           by svcs1.digex.net (8.8.4/8.8.4)
  6.       id OAA29643 for amos-out; Wed, 22 Jan 1997 14:45:47 -0500 (EST)
  7. Received: from mail3.access.digex.net (mail3.access.digex.net [205.197.247.4])
  8.           by svcs1.digex.net (8.8.4/8.8.4) with ESMTP
  9.       id OAA29639 for <amos-list@svcs1.digex.net>; Wed, 22 Jan 1997 14:45:47 -0500 (EST)
  10. Received: from cheetah.spots.ab.ca (root@cheetah.spots.ab.ca [204.191.210.12])
  11.           by mail3.access.digex.net (8.8.4/8.8.4) with SMTP
  12.       id OAA08879 for <amos-list@access.digex.net>; Wed, 22 Jan 1997 14:45:42 -0500 (EST)
  13. Received: from dcousins (pm103.spots.ab.ca [204.191.210.23]) by cheetah.spots.ab.ca (8.6.12/8.6.12) with ESMTP id MAA32347; Wed, 22 Jan 1997 12:45:29 -0700
  14. Message-Id: <199701221945.MAA32347@cheetah.spots.ab.ca>
  15. From: "dcousins" <dcousins@spots.ab.ca>
  16. To: "Mush" <mpd@mushy-pd.demon.co.uk>
  17. Cc: "AMOS List" <amos-list@access.digex.net>
  18. Subject: Re: goto
  19. Date: Sat, 5 Jan 1980 02:59:01 -0700
  20. X-MSMail-Priority: Normal
  21. X-Priority: 3
  22. X-Mailer: Microsoft Internet Mail 4.70.1155
  23. MIME-Version: 1.0
  24. Content-Type: text/plain; charset=ISO-8859-1
  25. Content-Transfer-Encoding: 7bit
  26. Status: RO
  27. X-Status: 
  28.  
  29. > From: Mush <mpd@mushy-pd.demon.co.uk>
  30. > To: dcousins <dcousins@spots.ab.ca>
  31. > Subject: Re: goto
  32. > Date: Wednesday, January 22, 1997 10:56 AM
  33. > At 07:36 PM 08-01-00 -0700, you wrote:
  34. > >> From: Hakan Venderlof <grok@karkis.canit.se>
  35. > >> To: amos-list@access.digex.net
  36. > >> Subject: goto
  37. > >> Date: Monday, January 21, 2097 8:11 AM
  38. > >> 
  39. > >> Do
  40. > >> Goto Rnd(4)
  41. > >> 0
  42. > >> <bla>
  43. > >> 1
  44. > >> <bla>
  45. > >> 2
  46. > >> <bla>
  47. > >> 3
  48. > >> <bla>
  49. > >> 4
  50. > >> <bla>
  51. > >> Loop
  52. > >> 
  53. > >> How can I get the program to go to each label
  54. > >> only once?  (randomly)
  55. > >> 
  56. > >> I do know some complicated ways to achive this but there must be some
  57. > >easy
  58. > >> solution...?
  59. > >
  60. > >I suppose you want an indefinate number of 'goto's.  This is really
  61. simple,
  62. > >and you shouldn't use goto's at all.  If you only want them to be
  63. execute
  64. > >once, then use an If..ElseIf..ElseIf..EndIf like the case function from
  65. > >'C'.
  66. > >
  67. > >If you want a number of functions to be executed in a random order, use
  68. a
  69. > >for loop, not a do.  Set up an array, then randomize it, then go through
  70. it
  71. > >using gosub's.  Here it is (I don't know if it works, just typing this
  72. on
  73. > >my PC).
  74. > >
  75. > >Dim A(xx) : Rem Where xx is the number of procedures
  76. > >For I=0 to xx
  77. > >    A(I)=I
  78. > >Next I
  79. > >For I=0 to xx
  80. > >    Swap A(Rnd(xx),Rnd(xx))
  81. > >Next I
  82. > >For I=0 to xx
  83. > >    Gosub A(I)
  84. > >Next I
  85. > >End
  86. > >
  87. > >1    Rem Place Your code here.
  88. > >    Return
  89. > >2    Rem Place Some more code here.
  90. > >    Return
  91. > >3
  92. > >...
  93. > >xx    Last Bit of code
  94. > >    Return
  95. > >
  96. > >> 
  97. > >> I think it should be possible to use arrays but I don't know how to
  98. set
  99. > >it up.
  100. > >
  101. > >    If this doesn't work (AMOS may not have true computed jumps, I can't
  102. > >remember right now), I figure out a different way.
  103. > >
  104. > >    TTFN
  105. > >
  106. > >    David
  107. > >
  108. > Guys, why not use a simpler solution. I found it very handy in Twinz. Use
  109. > the ON command:
  110. > do
  111. > r=rnd(4)
  112. > on r goto 1,2,3,4
  113. > loop
  114. > 1:
  115. > 2:
  116. > 3:
  117. > 4:
  118. > So simple and effective. It works with GOSUB and PROC too.
  119.  
  120.     Yes, but it doesn't do waht he needs it to do.  Each procedure can only be
  121. executed once, and in a random order.
  122.  
  123.     TTFN
  124.  
  125.     David